<template>
  <div class="sidebar">
    <div class="sidebar-title">后台管理系统</div>
    <div class="sidebar-box">
      <el-menu
        active-text-color="#ffd04b"
        background-color="#545c64"
        class="el-menu-vertical-demo"
        default-active="2"
        text-color="#fff"
        @open="handleOpen"
        @close="handleClose"
      >
        <SidebarItem :treeData="treeData" />
      </el-menu>
    </div>
  </div>
</template>

<script>
import SidebarItem from "./SidebarItem";
import store from "@/store";
export default {
  components: { SidebarItem },
  data() {
    return {
      treeData: []
    };
  },
  mounted() {
    this.getRouter();
  },
  methods: {
    handleOpen() {},
    handleClose() {},
    getRouter() {
      store.dispatch("GenerateRoutes").then(treeData => {
        this.treeData = treeData;
      });
    }
  }
};
</script>
<style scoped>
.sidebar {
  width: 100%;
  height: 100%;
  background: #545c64;
}
.sidebar-title {
  width: 100%;
  height: 50px;
  border-bottom: 1px solid #dcdfe6;
  color: #ffffff;
  box-sizing: border-box;
  text-align: center;
  line-height: 50px;
  font-size: 16px;
}
.sidebar-box {
  width: 100%;
  height: calc(100% - 64px);
  overflow-x: hidden;
  overflow-y: auto;
  -ms-overflow-style: none;
  overflow: "-moz-scrollbars-none";
  scrollbar-width: none; /*  火狐   */
}
.sidebar-box::-webkit-scrollbar {
  display: none; /*  Chrome  */
  width: 0 !important ; /*  Chrome  */
}
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 200px;
  min-height: 400px;
}
</style>
